package com.healthybear.demo.languagechange

import androidx.fragment.app.Fragment
import androidx.viewpager2.adapter.FragmentStateAdapter

/**
 * ViewPagerAdapter manages ViewPager2 pages with ContentFragment instances
 * 
 * Requirements addressed:
 * - 5.1: Display ViewPager2 with multiple pages in implementation activities
 * - 5.5: Maintain selected language when navigating between ViewPager2 pages
 */
class ViewPagerAdapter(fragment: Fragment) : FragmentStateAdapter(fragment) {
    
    companion object {
        private const val PAGE_COUNT = 3
    }
    
    /**
     * Returns the total number of pages in the ViewPager2
     */
    override fun getItemCount(): Int = PAGE_COUNT
    
    /**
     * Creates a new ContentFragment for the specified position
     * 
     * @param position The position of the page (0-based)
     * @return ContentFragment instance for the given position
     */
    override fun createFragment(position: Int): Fragment {
        return ContentFragment.newInstance(position)
    }
}